/*************************************************************************
	> File Name: maxTomin.c
	> Author:
	> Mail:
	> Created Time: 2017年02月04日 星期六 14时07分14秒
 ************************************************************************/

#include<stdio.h>
#include <stdlib.h>
#include<klee/klee.h>
#include "klee_change_macros.h"
char *as="old version", *bs="new version";
int t=0;
void next(int *a,int *b,char *ss){
    if(klee_change(*a> *b, *a<4))
    {
        t=1;
        //FILE *ff=fopen("file","w+");
        ss=as;
        a=b;
        //fprintf(ff,"%s\n",ss);
        //fclose(ff);
    }
    else{
        t=0;
        ss=bs;
        printf("%s\n", ss);
    }
    if(t){
        printf("%d\n", t);
    } else {
        printf("t==0\n");
    }
}
void foo(int *a,int *b,char *ss){
    next(a,b,ss);
}
int main(int argc, char* argv[]){
    int a,b,d;
    a=atoi(argv[1]);
    b=atoi(argv[2]);
    a=klee_change(4,6);
    FILE *ff=fopen(argv[3],"r");
    fprintf(ff,"open file %s",argv[3]);
    if (ff == NULL)
	{
      printf("open file %s failed\n",argv[3]);
	  return -1;
    } else {
      printf("open file %s\n",argv[3]);
      register int c = getc (ff);
      printf("open file %s succ, getc %d\n",argv[3],c);
    }
    fclose(ff);
    char *ss="";
    foo(&a,&b,ss);
//  FILE *ff3=fopen(argv[4],"w+");
//  fprintf(ff3,"open file again %s",argv[4]);
//  fclose(ff3);
    FILE *stream = fopen (argv[4], "r");
    if (stream == NULL)
	{
      printf("open file %s failed\n",argv[4]);
	  return -1;
    } else {
      printf("open file %s\n",argv[4]);
      register int c = getc (stream);
      printf("open file %s succ, getc %d\n",argv[4],c);
    }
    return 0;
}


